# sh testcase for shad $rm, $rn -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32

	.include "compact/testutils.inc"

	start

	.global null
null:
	mov #1, r0
	mov #0, r1
	shad r1, r0
	# no shift is performed.
	assert r0, #1

	.global gt0
gt0:
	mov #4, r0
	mov #3, r1
	shad r1, r0
	# shift left 3 bits.
	assert r0, #32

	.global lt0
lt0:
	mov #32, r0
	mov #3, r1
	neg r1, r1
	shad r1, r0
	# shift right 3 bits.
	assert r0, #4

	.global fillpos
fillpos:
	mov #1, r0
	mov #1, r1
	rotr r1
	shad r1, r0
	# check result.
	assert r0, #0

	.global fillneg
fillneg:
	mov #1, r0
	neg r0, r0
	mov #1, r1
	rotr r1
	shad r1, r0
	# check result.
	not r0, r0
	assert r0, #0
	
okay:
	pass
wrong:
	fail
